import 'package:flutter/material.dart';
import 'package:flutter_music/widgets/neu_box.dart';

class MusicPlayer extends StatelessWidget {
  final bool isPlaying;
  final VoidCallback? onPrevious;
  final VoidCallback? onCenter;
  final VoidCallback? onNext;

  const MusicPlayer({
    super.key,
    this.isPlaying = false,
    this.onPrevious,
    this.onCenter,
    this.onNext,
  });

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        GestureDetector(
          onTap: onPrevious,
          child: const NeuBox(
            child: Icon(Icons.skip_previous),
          ),
        ),
        Expanded(
          flex: 2,
          child: GestureDetector(
            onTap: onCenter,
            child: Container(
              margin: const EdgeInsets.symmetric(horizontal: 20),
              child: NeuBox(
                child: Icon(isPlaying ? Icons.pause : Icons.play_arrow),
              ),
            ),
          ),
        ),
        GestureDetector(
          onTap: onNext,
          child: const NeuBox(
            child: Icon(Icons.skip_next),
          ),
        ),
      ],
    );
  }
}


/* 
  去掉Button边距
  ElevatedButton(
    onPressed: () {},
    // 主要这三行代码
    style: ElevatedButton.styleFrom(
      minimumSize: Size.zero,
      padding: EdgeInsets.zero,
      tapTargetSize: MaterialTapTargetSize.shrinkWrap,
    ),
    child: const Text("去掉Button边距"),
),

 */